#ifndef SERIALDEVICE_H
#define SERIALDEVICE_H

#include <cserialport/SerialPort.h>
#include <cserialport/SerialPortInfo.h>

#include "deviceinterface.h"


class SerialDevice : public DeviceInterface
{
public:
    static std::vector<DevInfo> getDeviceInfo();
public:
    SerialDevice(const std::string &com);

    ~SerialDevice() override;

    void write(const std::vector<uint8_t>& data, const uint16_t &timeout) override;

    bool isOpen() const override;

    std::string getDescription() const override;
protected:
    void close();
private:
    std::unique_ptr<itas109::CSerialPort> m_serial;
};

#endif // SERIALDEVICE_H
